Taking care of the possible null value that can be returned by mediaExtractor.getTrackFormat #100
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there 👋 .
We have this issue here where we get the following:
Looking into it, we are getting that Null Pointer Exception in some cases/conditions:
If I'm not wrong, the issue seems related to the fact that the
mediaExtractor.getTrackFormat
can return a null value:and in one case I could verify we had 3 tracks rescued by
mediaExtractor.getTrackFormat
with valuesthe first raw is a possible scenario when we can get the crash returning a null value.
Linking to the lib code of this PR I could verify that all worked ok for me. Also checked the samples in the lib and AFAIU seems working ok.
I see the lib is already checking that possible null return value in all the other places in
MediaSource.java
so the modification should just add that check all over the places where it's used.I was wondering if you could review this PR and confirm if it can be fine to merge (I'm not familiar with your code base so happy to get your feedbacks).
Thanks for your attention and time 🙇♂️.